package com.icss.mqsp.builder.factory;

import com.icss.mqsp.builder.IBuilder;
import com.icss.mqsp.config.PropertyConfig;
import com.icss.mqsp.util.ResourcesUtil;
import com.icss.pangu.logging.Log;
import com.icss.pangu.logging.LogFactory;

public class BuilderFactory
{
  private static Log log = LogFactory.getLog(BuilderFactory.class);
  
  public static IBuilder getBuilder(String type)
  {
    PropertyConfig pc = PropertyConfig.getInstance("function");
    String builder = pc.getProperty(type);
    IBuilder ibuilder = null;
    try
    {
      ibuilder = (IBuilder)ResourcesUtil.instantiate(builder);
    }
    catch (Exception e)
    {
      log.error(e.toString());
    }
    return ibuilder;
  }
}
